package file;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author shxl2021
 * @Date 2023/8/11 15:35
 * @Version 1.0
 */
public class FindeAllFile {
    private static final String path="C:\\Users\\LENOVO\\Downloads\\ecology-按月创建表-tj-230905\\ecology\\classbean";

    public static void main(String[] args) throws Exception{
        List<File> allFile = getAllFile(path);
        for (File file : allFile) {
            System.out.println(file.getAbsolutePath());
        }
    }

    public static List<File> getAllFile(String path) {
        File file = new File(path);
        ArrayList<File> files = new ArrayList<>();
        getSon(file.listFiles(),files);
        return files;
    }

    private static void getSon(File[] inputFile,List<File> result) {
        for (File file : inputFile) {
            if (file.isDirectory()) {
                getSon(file.listFiles(),result);
            } else {
                result.add(file);
            }
        }

    }

}
